package proxy;

import base.Employeee;
import proxy.test.TestImpl;
import proxy.test.TestInf;
import sun.misc.Unsafe;
import java.io.IOException;
import java.util.HashMap;
import java.util.Timer;
import java.util.concurrent.TimeUnit;

/**
 * Created by root on 2/22/17.
 */
public class Main {

    //private static final Unsafe unsafe = Unsafe.getUnsafe();


    @Override
    protected void finalize() throws Throwable {
        System.out.println("--");
        super.finalize();
    }

    public static void main(String[] args){
        JdkProxy jdkProxy = new JdkProxy();
        TestInf test = (TestInf) jdkProxy.newProxy(new TestImpl());
        test.get();
        test.test();

//        CglibProxy cglibProxy = new CglibProxy();
//        TestImpl test2 = (TestImpl) cglibProxy.getProxy(TestImpl.class);
//        test2.test();


        Thread shutdownHookOne = new Thread() {
            public void run() {
                System.out.println("shutdownHook one...");
            }
        };
        Runtime.getRuntime().addShutdownHook(shutdownHookOne);


//        String key = "root";
//        try {
//            String hello = new Shell.Plain(new SSH("115.29.246.216",22,"root",key)).exec("ls -lha");
//            System.out.println(hello);
//
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
    }
}
